﻿using System;
using System.Linq;

namespace FizzBuzzConsoleClient
{
    public class Program
    {
        public static void Main()
        {
            var fizzBuzzNumbers = Enumerable.Range(1, 100).Select(n => new FizzBuzzNumber(n));
            foreach (var fizzBuzzNumber in fizzBuzzNumbers)
            {
                Console.WriteLine(fizzBuzzNumber.ToString());
            }
        }
    }

    public class FizzBuzzNumber
    {
        private readonly int _value;

        public FizzBuzzNumber(int value)
        {
            if (value < 0)
                throw new NotSupportedException("Negative values are not supported.");
            _value = value;
        }

        public override string ToString()
        {
            if (IsMultipleOf(3) &&
                IsMultipleOf(5))
                return "FizzBuzz";
            if (IsMultipleOf(5))
                return "Buzz";
            if (IsMultipleOf(3))
                return "Fizz";
            return _value.ToString();
        }

        private bool IsMultipleOf(int number)
        {
            if (_value == 0)
                return false;
            return _value % number == 0;
        }
    }
}
